package xcmg.device.dao.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.company.CompanyInfoDO;
import xcmg.device.service.vo.company.CompanyInfoVO;
import xcmg.device.service.vo.company.CompanySearchConditionVO;

import java.util.List;

@Mapper
public interface CompanyInfoMapper {

    int removeCompany( @Param("orgId")String orgId);

    int insert(CompanyInfoDO record);

    CompanyInfoDO item(String orgId);
    
    CompanyInfoDO getDealerInfo(String orgId);

    int update(CompanyInfoDO record);

    CompanyInfoDO checkCompanyExist(CompanyInfoDO companyInfoDO);

    CompanyInfoDO checkSAPCodeExist(CompanyInfoDO companyInfoDO);

    List<CompanyInfoDO> list(CompanyInfoVO record);
    List<CompanyInfoDO> listUnBind(CompanySearchConditionVO record);
    List<CompanyInfoDO> sapList();

    CompanyInfoDO itemBySap(@Param("sapCode")String sapCode);

    CompanyInfoDO itemByOrgCode(@Param("orgCode")String orgCode);

    /**
     * 公司单据前缀自增序列
     *
     * @return
     */
    Integer getDocumentPre();

    /**
     * 根据平台公司的orgId找出其对应的所有主机厂
     *
     * @param platOrgId
     * @return
     */
    List<CompanyInfoDO> listSapComByDealer(@Param("platOrgId") String platOrgId);

    String getSapCodeByOrgId(@Param("orgId") String orgId);

    String getOrgIdBySapCode(@Param("sapCode") String sapCode);

    List<String> listOrgIdsByName(@Param("companyName") String companyName);

    List<CompanyInfoDO> selectBatchByOrgIds(List<String> ids);

    List<CompanyInfoDO> listCoreComs(CompanyInfoVO companyInfoVO);

    List<CompanyInfoDO> listCoreComsForCore(CompanyInfoVO companyInfoVO);

    List<CompanyInfoDO> items(@Param("orgIds") List<String> orgIds);

    List<String> getSalesCodes(@Param("ynOrgId") String ynOrgId,@Param("deptId") String deptId);

    List<CompanyInfoDO> queryCommpanyInfoBySuplierNos(@Param("suplierNos")  List<String> suplierNos);
}
